<%-- 
    Document   : QuanLyTinTucContent
    Created on : Nov 4, 2011, 3:02:54 PM
    Author     : kijoo
--%>

<%@page import="MODEL.POJO.TinTucPOJO"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<div id="dmchon">
    <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quản Lý Tin Tức
    </strong>
</div> 
<div class="noidung"> 
    <table width="100%" border="0" align="center">
        <tr>   
            <td width="17%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Số TT </td>
            <td width="57%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Tên bản tin</td>
            <td width="13%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Sửa</td>
            <td width="13%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Xóa</td>
        </tr>
        <%
            ArrayList<TinTucPOJO> dstt = (ArrayList<TinTucPOJO>) request.getAttribute("DanhSachTinTuc");
            for (int j = 0; j < dstt.size(); j++) {
                TinTucPOJO tt = dstt.get(j);
        %>

        <tr>
            <td align="center"><%=tt.getIdtintuc()%></td>
            <td align="center"><%=tt.getTen()%></td>  
            <td align="center"><a href="AdminController?Action=SuaTin&idtin=<%=tt.getIdtin()%>"><img src="images/edit_40b.png" width="16" height="16"></a></td>
            <td align="center"><a href="AdminController?Action=XoaTin&idtin=<%=tt.getIdtin()%>"><img src="images/delete_button.gif" width="20" height="20"></a></td>
        </tr>

        <% }%>
    </table>
    <hr>
    <%
        if (request.getAttribute("GiaTriSua") == "1") {

            TinTucPOJO ttsua = (TinTucPOJO) request.getAttribute("ChiTietTinTucSua");
    %>
    <form onSubmit="return kiemtra()" action="AdminController" method="get" name="form1" id="them">
        <table width="69%" height="210" border="0" align="center">
            <tr>
                <td width="31%"><div align="center">Tên bản tin </div></td>
                <td width="69%"><input name="ten" type="text" value="<%= ttsua.getTen()%>" size="50">
                    <input name="idtin" type="hidden" value="<%=ttsua.getIdtin() %>">                </td>
            </tr>
            <tr>
                <td><div align="center">Tóm tắt bản tin</div></td>
                <td><input name="tomtat" type="text" value="<%= ttsua.getTomtat()%>" size="50"></td>
            </tr>
            <tr>
                <td><div align="center">Hình </div></td>
                <td><input name="hinh" type="file" value="<%= ttsua.getHinh()%>" ></td>
            </tr>
            <tr>
                <td><div align="center">Nội dung bản tin</div></td>
                <td><input name="noidung" type="text" value="<%= ttsua.getNoidung()%>" size="40"></td>
            </tr>
            <tr>
                <td><div align="center">Ghi chú</div></td>
                <td><input name="ghichu" type="text" value="<%= ttsua.getGhichu()%>" size="40"></td>
            </tr>
            <tr>
                <td>
                    <div align="center">
                      <input type="submit" name="btSuaTin" id="btSuaTin" value="Sửa" style="background-color:#FFFF66">
                    </div></td>
            </tr>
        </table>
    </form>

    <%
        }
    %>
    <%-- phan trang --%>

</div>
    <script language="JavaScript">
    function kiemtra()
    {
        form1=document.getElementById("them");
        if(form1.ten.value=="")
        {
            alert("Chưa nhập tên bản tin"); form1.ten.focus(); return false; 
        }
        if(form1.tomtat.value=="")
        {
            alert("Chưa nhập tóm tắt bản tin"); form1.tomtat.focus(); return false; 
        }
		if(form1.noidung.value=="")
        {
            alert("Chưa nhập nội dung bản tin"); form1.noidung.focus(); return false; 
        }
		if(form1.ghichu.value=="")
        {
            alert("Chưa nhập ghi chú bản tin"); form1.ghichu.focus(); return false; 
        }
        return true;
    }
</script> 


